Fix flaky HoverTest.testEnabledWhenHover() race condition #3524
+7
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the random failure in
HoverTest.testEnabledWhenHover()by ensuring the hover shell from the first test part is fully disposed before the second part begins.Root Cause
The test has two parts that test hover behavior with different
EnabledPropertyTesterstates:setEnabled(true)- shows one hoversetEnabled(false)- shows a different hoverThe race condition occurred because:
cleanFileAndEditor()was calledgetHoverShell()would timeout waiting for the new hover shell (line 175 in the stack trace)Fix
Added explicit waiting for the first hover shell to be disposed:
cleanFileAndEditor()as beforeDisplayHelper.waitForCondition()to wait up to 3000ms for the shell to be disposedThis ensures complete state reset between the two test phases.
Pattern
This fix follows the same pattern used in other recent flaky test fixes in this repository:
Both use condition-based waiting with
DisplayHelper.waitForCondition()to ensure proper cleanup between test phases rather than relying on timing.Test Plan
Due to environment issues, I was unable to run the full test suite locally. However, the fix follows established patterns from recent successful flaky test fixes in this repository.
Fixes #926
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]